def jdz(x):
    '''绝对值'''
    return x if x >= 0 else -x

if __name__ == '__main__':
    n = int(input())
    nums = [int(x) for x in input().split(' ')]

    # 合规数组
    h1 = [0, 1] * n 
    h2 = [1, 0] * n

    # 对比差距
    c1 = sum([jdz(h1[i] - nums[i]) for i in range(len(nums))])
    c2 = sum([jdz(h2[i] - nums[i]) for i in range(len(nums))])
    c = min(c1, c2)

    r = c // 2  # 每次交换可以减少两个不同
    print(r)
